#include<iostream>
#include<mutex>
#include<condition_variable>

bool bFlag = false;
std::mutex m;
std::condition_variable cv;

void thread1(void)
{
	std::unique_lock<std::mutex> lock(m);
	cv.wait(lock, []() {
		bool res = bFlag;
		std::this_thread::sleep_for(std::chrono::seconds(1));
		return res;
	});

	std::cout << "wait finish!!!!" << std::endl;
}

void thread2(void)
{
	bFlag = true;
	cv.notify_one();
}

int main(void)
{
	std::thread t1(thread1);
	std::thread t2(thread2);

	t1.join();
	t2.join();
}